package com.pasic.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pasic.model.po.Person;
import com.pasic.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Wrapper;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xujiaxin
 * @since 2019-09-24
 */
@RestController
@RequestMapping("/person")
public class PersonController{

    @Autowired private IPersonService personService;

    @PostMapping("insert")
    @ResponseBody
    public Object insert(Person person){
        personService.save(person);
        return "成功";
    }

    @PostMapping("get")
    @ResponseBody
    public Object get(){
        QueryWrapper<Person> query = new QueryWrapper<>();
        List<Person> list = personService.list(query);
        return list;
    }


}
